NAME= 		find_prime.bin

MODULE=		prime.so

SRC_COMMON= 	../../library
SRC_CPP=	$(SRC_COMMON)/mutex.cpp			\
		$(SRC_COMMON)/saddr.cpp			\
		$(SRC_COMMON)/socket.cpp		\
		$(SRC_COMMON)/thread.cpp		\
		$(SRC_COMMON)/protocol.cpp		\
		$(SRC_COMMON)/adistributedmodule.cpp	\
		prime.cpp				\
		prime_main.cpp

SRC_MODULE=	$(SRC_COMMON)/mutex.cpp			\
		$(SRC_COMMON)/saddr.cpp			\
		$(SRC_COMMON)/socket.cpp		\
		$(SRC_COMMON)/thread.cpp		\
		$(SRC_COMMON)/protocol.cpp		\
		$(SRC_COMMON)/adistributedmodule.cpp	\
		prime.cpp

CFLAGS=		-W -Wall -ansi -pedantic -O2 -g
CLIBS=		-pthread

CC=		g++

all:	$(NAME) $(MODULE)

$(NAME):
	$(CC) $(CFLAGS) $(CLIBS) $(SRC_CPP) -o $(NAME)

$(MODULE):
	g++ -shared -fPIC $(CFLAGS) $(CLIBS) $(SRC_MODULE) -o $(MODULE)

clean:
	rm -f *~

fclean:	clean
	rm -f $(NAME)
	rm -f $(MODULE)

re:	fclean all
